Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
' Variables for positioning the image.
Dim OldX As Single
Dim OldY As Single
Dim CurX As Single
Dim CurY As Single
Dim OffsetX As Single
Dim OffsetY As Single
Dim PicWid As Single
Dim PicHgt As Single
Dim Xmax As Single
Dim Ymax As Single
Dim Dragging As Boolean
' Draw the picture at (CurX, CurY).
Private Sub DrawPicture()
' Fix the part of the image that was covered.
BitBlt picCanvas.hDC, _
OldX, OldY, PicWid, PicHgt, _
picHidden.hDC, OldX, OldY, SRCCOPY
OldX = CurX
OldY = CurY
' Paint on the new image.
BitBlt picCanvas.hDC, _
CurX, CurY, PicWid, PicHgt, _
picXMask.hDC, 0, 0, MERGEPAINT
BitBlt picCanvas.hDC, _
CurX, CurY, PicWid, PicHgt, _
picX.hDC, 0, 0, SRCAND
' Update the display.
picCanvas.Refresh
End Sub
' Save picCanvas's original bitmap bytes,
' initialize values, and draw the initial picture.